package Java7_Concurrency_Cookbook.concurrency_test.reentrant_lock_test;

import java.util.Collection;
import java.util.concurrent.locks.ReentrantLock;

/**
 * @author lixiangke
 * @date 2017/12/4
 */
public class MyLock extends ReentrantLock {

    public String getOwnerName() {
        if (this.getOwner() == null) {
            return "None";
        }
        return this.getOwner().getName();
    }

    /**
     * 等待获取此锁的线程列表
     */
    public Collection<Thread> getThreads() {
        return this.getQueuedThreads();
    }

}
